<?php

namespace app\admin\model\store;

use app\admin\model\freight\ExpressDelivery;
use app\common\model\TimeModel;

class PinkConfig extends TimeModel
{

    protected $name = "pink_config";

    protected $deleteTime = "delete_time";

    public function freight()
    {
        return $this->belongsTo(ExpressDelivery::class, 'freight_id', 'id');
    }

    public function sku()
    {
        return $this->belongsTo(GoodsSku::class, 'goods_sku_id', 'id')->bind([]);
    }

    //根据拼团活动ID查询拼团信息
    public static function pinkInfo($pinkId)
    {
        $withoutField = [
            'delete_time',
            'update_time',
            'create_time',
        ];
        $data = self::withoutField($withoutField)->find($pinkId);
        $data && $data = $data->toArray();
        return $data;
    }

}